GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#61)
by Benjamin
13:47 queued 12:17
created

getCurrentRecords.js ➔ ???   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 40

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
c 2
b 0
f 0
nc 3
dl 0
loc 40
rs 8.8571
nop 7
1
export const getCurrentRecords = (
2
    dataSource,
3
    pageIndex,
4
    pageSize,
5
    infinite,
6
    viewableIndex,
7
    viewableCount,
8
    bufferMultiplier
9
) => {
10
11
    if (!dataSource) {
12
        return {};
13
    }
14
15
    if (infinite) {
16
        const start = Math.max(
17
            viewableIndex - viewableCount * bufferMultiplier,
18
            0
19
        );
20
21
        const end = Math.min(
22
            viewableIndex + viewableCount * (bufferMultiplier + 1),
23
            dataSource.currentRecords.length
24
        );
25
26
        return {
27
            data: dataSource.data.slice(start, end),
28
            startIndex: start,
29
            endIndex: end
30
        };
31
    }
32
33
    return {
34
        data: dataSource.data.slice(
35
            pageIndex * pageSize, (pageIndex + 1) * pageSize
36
        ),
37
        startIndex: null,
38
        endIndex: null
39
    };
40
};
41